﻿<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
         xmlns:db="http://www.springframework.net/database">

  <description>Data Access Objects.</description>


  <object id="ClassicDao" type="Framework.Impl.Dao.ClassicDao, Framework.Impl">
    <property name="HibernateTemplate" ref="CHibernateTemplate"/>
    <property name="AdoTemplate" ref="CAdoTemplate"/>
  </object>

  <!-- placeholder configurer-->
  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="databaseSettings"/>
  </object>

  <!-- Database and NHibernate Configuration -->
  <!--<db:provider id="DbProvider" provider="OracleClient-2.0"
     connectionString="Data Source=(DESCRIPTION = 
             (ADDRESS_LIST = 
                (ADDRESS = (PROTOCOL = TCP)(HOST = ${db.datasource})(PORT = 1541))
                (ADDRESS = (PROTOCOL = TCP)(HOST = ${db.datasource2})(PORT = 1541))
                (load_balance=yes)
             )(CONNECT_DATA = (SERVICE_NAME = ${db.database})(server = dedicated))
         );
         User Id=${db.user};Password=${db.password};"/>-->
  <db:provider id="DbProvider" provider="MySql-5.2.3"
                 connectionString="Data Source=${db.datasource};database=${db.database};uid=${db.user};pwd=${db.password};"/>
  <object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="MappingAssemblies">
      <list>
        <value>Contract</value>
      </list>
    </property>
    <property name="HibernateProperties">
      <dictionary>
        <entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
        <entry key="dialect" value="NHibernate.Dialect.MySQL5Dialect"/>
      <entry key="connection.driver_class" value="NHibernate.Driver.MySqlDataDriver"/>
        <entry key="show_sql" value="true"/>
        <entry key="use_proxy_validator" value="true"/>
        <entry key="hibernate.current_session_context_class"
              value="Spring.Data.NHibernate.SpringSessionContext, Spring.Data.NHibernate30"/>
      </dictionary>
    </property>

  </object>

  <!-- Classic Template -->
  <object id="CHibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate">
    <property name="SessionFactory" ref="SessionFactory" />
    <property name="TemplateFlushMode" value="Auto" />
    <property name="CacheQueries" value="true" />
  </object>
  <object id="CAdoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="DataReaderWrapperType" value="Spring.Data.Support.NullMappingDataReader, Spring.Data"/>
  </object>
</objects>
